package com.skyolder.milkbee.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A Advertisement.
 */
@Entity
@Table(name = "advertisement")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Advertisement implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "title")
    private String title;

    @Column(name = "image")
    private String image;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    @Column(name = "start_at")
    private ZonedDateTime startAt;

    @Column(name = "end_at")
    private ZonedDateTime endAt;

    @Column(name = "weblink")
    private String weblink;

    @Column(name = "category_id")
    private Long categoryId;

    @Column(name = "width")
    private Integer width;

    @Column(name = "height")
    private Integer height;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public Advertisement title(String title) {
        this.title = title;
        return this;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public Advertisement image(String image) {
        this.image = image;
        return this;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public ZonedDateTime getCreatedAt() {
        return createdAt;
    }

    public Advertisement createdAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public void setCreatedAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public ZonedDateTime getStartAt() {
        return startAt;
    }

    public Advertisement startAt(ZonedDateTime startAt) {
        this.startAt = startAt;
        return this;
    }

    public void setStartAt(ZonedDateTime startAt) {
        this.startAt = startAt;
    }

    public ZonedDateTime getEndAt() {
        return endAt;
    }

    public Advertisement endAt(ZonedDateTime endAt) {
        this.endAt = endAt;
        return this;
    }

    public void setEndAt(ZonedDateTime endAt) {
        this.endAt = endAt;
    }

    public String getWeblink() {
        return weblink;
    }

    public Advertisement weblink(String weblink) {
        this.weblink = weblink;
        return this;
    }

    public void setWeblink(String weblink) {
        this.weblink = weblink;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public Advertisement categoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public Integer getWidth() {
        return width;
    }

    public Advertisement width(Integer width) {
        this.width = width;
        return this;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public Advertisement height(Integer height) {
        this.height = height;
        return this;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Advertisement advertisement = (Advertisement) o;
        if (advertisement.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, advertisement.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Advertisement{" +
            "id=" + id +
            ", title='" + title + "'" +
            ", image='" + image + "'" +
            ", createdAt='" + createdAt + "'" +
            ", startAt='" + startAt + "'" +
            ", endAt='" + endAt + "'" +
            ", weblink='" + weblink + "'" +
            ", categoryId='" + categoryId + "'" +
            ", width='" + width + "'" +
            ", height='" + height + "'" +
            '}';
    }
}
